﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SwiftCode.BBS.Common.Helper;

namespace swiftCode.Bbs.API.Controllers
{
    [Route("api/[controller]")]
    
    [ApiController]
    public class LoginController : ControllerBase
    {
        [HttpGet]
        public async Task<object> GetJwtStr(string name, string pass)
        {
            TokenModelJWT tokenModel = new TokenModelJWT {Uid = 1, Role = "Admin" };
            var jwtStr = JWTHelper.IssueJwt(tokenModel);
            var suc = true;
            return Ok(new
            {
                success = suc, 
                tokenModel = jwtStr
            }            
            );
        }
    }
}
